{include file="public/header" /}

<style>
    body{
        background: #FFF;
    }

</style>

<div class="page">
    <a href="javascript:history.go(-1)" class="btn" title="返回上一步">返回上一步</a>
    <table class="ds-default-table order">
        <tbody>
        <!--  <tr class="space">
            <th colspan="2">{$Think.lang.order_detail}</th>
        </tr> -->
        <tr>
            <th>{$Think.lang.order_info}</th>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <li><strong>{$Think.lang.ds_order_sn}:</strong>{$order_info.order_sn}</li>
                    <li><strong>{$Think.lang.order_state}:</strong>{$order_state[$order_info.order_state]}</li>
                    <li><strong>订单类型:</strong>{$order_type[$order_info.order_type]}</li>
                    <li><strong>订单预约时间:</strong>{$order_info.appointment_time}</li>
                    <li><strong>订单创建时间:</strong>{$order_info.add_time|date="Y-m-d H:i:s",###}</li>
                    <li><strong>订单备注:</strong>{$order_info.remarks}</li>
                </ul>
            </td>
        </tr>

        <tr>
            <th>买家信息</th>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <li><strong>买家账号:</strong>{$order_info.member_name}</li>
                    <li><strong>运营商:</strong>{$order_info.invite_store_name}</li>
                </ul>
            </td>
        </tr>

        {notempty name="order_info.address"}
        <tr>
            <th>客户信息</th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li><strong>客户姓名{$Think.lang.ds_colon}</strong>{$order_info.address.address_realname}</li>
                    <li><strong>客户电话:</strong>{$order_info.address.address_tel_phone}</li>
                    <li><strong>客户地址{$Think.lang.ds_colon}</strong>{$order_info.address.area_info}&nbsp;{$order_info.address.address_detail}&nbsp;</li>
                </ul>
            </td>
        </tr>
        {/notempty}
        <!--<?php if (!empty($order_info['extend_order_common']['invoice_info'])) {?>-->
        <!--<tr>-->
            <!--<th>{$Think.lang.invoice_info}</th>-->
        <!--</tr>-->
        <!--<tr>-->
            <!--<td><ul>-->
                <!--<?php foreach ((array)$order_info['extend_order_common']['invoice_info'] as $key => $value){?>-->
                <!--<li><strong>{$key}{$Think.lang.ds_colon}</strong>{$value}</li>-->
                <!--<?php } ?>-->
            <!--</ul></td>-->
        <!--</tr>-->
        <!--<?php } ?>-->
        {notempty name="order_info.zhu_order_info"}
        <tr>
            <th>服务设备列表
            </th>
        </tr>

        <tr>
            <td><table class="ds-default-table goods ">
                <tbody>
                <tr>
                    <th class="align-center">设备编号</th>
                    <th class="align-center">设备名称</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">操作</th>
                </tr>
                {foreach name="$order_info.zhu_order_info" item="goods"}
                <tr>
                    <td class="w20 align-center"><p>{$goods.goods_id}</p></td>
                    <td class="w20 align-center"><p>{$goods.goods_name}</p></td>
                    <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                    <td class="w96 align-center">
                        <a href="javascript:dsLayerOpen('{:url('Service/show_detail',['id'=>$goods.id])}','{$Think.lang.ds_view} 子订单详情')" class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                    </td>

                </tr>
                {/foreach}
                </tbody>
            </table>
            </td>
        </tr>
        {/notempty}

        <tr>
            <th>追加服务设备列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tbody>
                <tr>
                    <th class="align-center">设备编号</th>
                    <th class="align-center">设备名称</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">状态</th>
                    <th class="align-center">工时</th>
                    <th class="align-center">每工时费用</th>
                    <th class="align-center">服务工时费</th>
                    <th class="align-center">操作</th>
                </tr>
                {foreach name="$order_info.goods_items" item="goods"}
                <tr>
                    <td class="w5 align-center"><p>{$goods.goods_id}</p></td>
                    <td class="w20 align-center"><p>{$goods.goods_name}</p></td>
                    <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                    <td class="w20 align-center"><p>{$order_state[$goods.order_state]}</p></td>
                    <td class="w20 align-center"><p id="need_hours" data-value="{$goods.need_hours}">{$goods.need_hours}</p></td>
                    <td class="w20 align-center"><p id="payper_hour" data-value="{$goods.payper_hour}">{$goods.payper_hour}</p></td>
                    <td class="w20 align-center"><p>{$goods.fuwu_hour}</p></td>
                    <td class="w20 align-center">
                        <a href="javascript:dsLayerOpen('{:url('Service/append_setting',['detail_order_id'=>$goods.id])}','设置服务费 {$Think.lang.ds_service_order}-{$order_info.order_sn}')" class="dsui-btn-add"><i class="iconfont"></i>查看+服务费</a>

                        <a href="{:url('Service/projec_goods',['detail_order_id'=>$goods.id])}" class="dsui-btn-add"><i class="iconfont"></i>+附件</a>
                    </td>
                </tr>
                {/foreach}
                </tbody>
            </table>
            </td>
        </tr>

        {notempty name="order_log"}
        <tr>
            <th>{$Think.lang.order_handle_history}</th>
        </tr>
        {foreach name="order_log" item="val"}
        <tr>
            <td>
                {$val.log_role} {$val.log_user}&emsp;{$Think.lang.order_show_at}&emsp;{$val.log_time|date="Y-m-d H:i:s",###}&emsp;{$val.log_msg}
            </td>
        </tr>
        {/foreach}
        {/notempty}
        <tr>
            <th>审核是否通过
               
            </th>
        </tr>
        <form id="store_form" method="post" novalidate="novalidate">
            <input type="hidden" id='is_have_hours' value="{$is_have_hours}">
            <input type="hidden" id='is_choice_part' value="{$is_choice_part}"> 
            <table class="ds-default-table">
                <!--店主账号-->
                <tbody>
                <!--状态-->
                <input type="hidden" name="order_id" value={$order_info.order_id} >
                <tr class="noborder" style="background: rgb(255, 255, 255);">
                    <td class="w120"><label class="" for="">审核是否通过:</label></td>
                    <td class="vatop rowform onoff">

                        <select name="order_state" id="order_state">
                            <option value="2">通过</option>
                            <option value="6">未通过</option>
                        </select>
                        
                    </td>
                    <td class="vatop tips"></td>
                </tr>

                <!--关闭原因-->
                <tr class="noborder" id="tr_store_close_info" style="display: none;">
                    <td class="w120"><label class="" for="">审核失败原因:</label></td>
                    <td class="vatop rowform"><textarea name="examine_failed_reason" rows="6" class="tarea" id="store_close_info"></textarea></td>
                    <td class="vatop tips"></td>
                </tr>

                <!--<tr class="noborder" style="background: rgb(255, 255, 255);">-->
                    <!--<td class="w120"><label class="" for="">是否需要拆单:</label></td>-->
                    <!--<td class="vatop rowform onoff"><label for="store_state4" class="cb-enable selected"><span>需要</span></label>-->
                        <!--<label for="store_state3" class="cb-disable "><span>不需要</span></label>-->
                        <!--<input id="store_state4" name="is_demolition" checked="checked" value="1" type="radio">-->
                        <!--<input id="store_state3" name="is_demolition"  value="0" type="radio"></td>-->
                    <!--<td class="vatop tips"></td>-->
                <!--</tr>-->

                <tr class="noborder" style="background: rgb(255, 255, 255);" id="dors">
                    <td class="required">追加上门费: </td>
                    <td class="vatop rowform"><input type="text" value="0" name="door_fee" id="door_fee" class="txt"></td>
                    <td class="vatop tips">请输入数字</td>
                </tr>

                <tr class="noborder" id="fuwu">
                    <td class="required">追加服务内容: </td>
                    <td class="vatop rowform"><textarea name="service_content" id="service_content"  rows="6" class="tarea"></textarea></td>
                    <td class="vatop tips"></td>
                </tr>

                <tr class="noborder" style="background: rgb(255, 255, 255);" id="beizhu">
                    <td class="required">追加备注: </td>
                    <td class="vatop rowform"><input type="text" name="manager_remark" class="txt"></td>
                    <td class="vatop tips">请输入备注</td>
                </tr>
                </tbody>
                <tfoot>
            <tr class="tfoot">

                <td colspan="15">
                
                    <input class="btn" id="clis" type="button" style="line-height: 30px" value="提交">

                </td>
                
            </tr>
            </tfoot>
            </table>
        </form>
        </tbody>
    </table>
</div>

<script>
        $(document).ready(function () {
        $("#clis").click(function (e) {
            var status = $('#order_state').val();
            var store_close_info = $('#store_close_info').val();
            var door_fee = $('#door_fee').val();
            var service_content = $('#service_content').val();
            var is_have_hours = $('#is_have_hours').val();
            var is_choice_part = $('#is_choice_part').val();

             if(status == 2){
                if (is_have_hours == 1) {
                    layer.msg('请设置服务费');
                    return false;
                }
                if (is_choice_part == 0) {
                    layer.msg('请为服务人员设置配件价格');
                    return false;
                }
             }
            if (status != 6) {
                if (door_fee.replace(/\s+/g, "") == '' || service_content
                    .replace(/\s+/g, "") == '') {
                    layer.msg('请填写正确的服务内容');
                    return false;
                }
            }


            if (status == 6 && store_close_info.replace(/\s+/g, "") == '') {
                layer.msg('请填写审核失败原因');
                return false;
            }

            if (status == 2) {
               
                if (door_fee == 0) {
                    layer.confirm('上门费用为0元确认提交吗？', {
                        title: '温馨提示'
                    }, function (index) {
                        $("form").submit();
                    })
                    return false;
                }
            }
            $("form").submit();
        });
            
    });


    $(function() {
        $('#order_state').change(function() {
            if ($(this).val() == '6') {
                $('#tr_store_close_info').show();
                $('#dors').hide();
                $('#fuwu').hide();
                $('#beizhu').hide();
                
            } else {
                $('#tr_store_close_info').hide();
                $('#dors').show();
                $('#fuwu').show();
                $('#beizhu').show();
            }
        });
    });

</script>
